//package cn.nfwx.tv.fragment.download;
//
//import android.view.View;
//import android.widget.Toast;
//
//import org.greenrobot.eventbus.EventBus;
//import org.greenrobot.eventbus.Subscribe;
//import org.greenrobot.eventbus.ThreadMode;
//
//import cn.nfwx.tv.R;
//import cn.nfwx.tv.adapter.DownLoadingAdapter;
//import cn.nfwx.tv.base.BaseFragment;
//import cn.nfwx.tv.controller.DownloadViewController;
//import cn.nfwx.tv.events.DownLoadingEditEvents;
//import cn.nfwx.tv.manager.DownLoadManager;
//import cn.nfwx.tv.util.NetworkUtil;
//import cn.nfwx.tv.util.SharePrefUtil;
//import p2psvideo.P2PSMgr;
//
///**
// *Create by zb.liu  by 2017/11/07
// */
//public class DownLoadingFragment extends BaseFragment implements DownLoadingAdapter.OnItemClickListener {
//    private final static String TAG_LOG = DownLoadingFragment.class.getSimpleName();
//    private DownloadViewController downloadViewController;
//
//    @Override
//    public View initView() {
//        View  view=View.inflate(mContext, R.layout.fragment_down_loading,null);
//        downloadViewController=new DownloadViewController(getActivity(),view);
//        downloadViewController.setItemListener(this);
//        EventBus.getDefault().register(this);
//        return view;
//    }
//
//    @Override
//    public void initData() {
//        super.initData();
//    }
//
//    @Override
//    public void onResume() {
//        super.onResume();
//
//    }
//
//    @Subscribe(threadMode = ThreadMode.MAIN)
//    public void editEventBus(DownLoadingEditEvents events) {
//        downloadViewController.getAdapter().setDelete(events.isFlag());
//        downloadViewController.getAdapter().getDeleteData().clear();
//        downloadViewController.getAdapter().notifyDataSetChanged();
//        downloadViewController.setBottomLayoutVisiable(events.isFlag());
//    }
//
//    @Override
//    public void onDestroyView() {
//        super.onDestroyView();
//        downloadViewController.onDestory();
//        EventBus.getDefault().unregister(this);
//    }
//
//    @Override
//    public void onItemClick(View view, int position, final P2PSMgr.P2PSFileInfo fileInfo) {
//
//        if(! fileInfo.forDownload){
//            if(!SharePrefUtil.getDownloadChoose(getActivity())&& NetworkUtil.getNetworkType(getActivity())!=1){
//                Toast.makeText(getActivity(),"当前网络不是WIFI环境，请到设置中修改缓存策略或连接WIFI",Toast.LENGTH_SHORT).show();
//                return ;
//            }
//            DownLoadManager.startDownLoad(getActivity(),fileInfo.vsid);
//        }else{
//            DownLoadManager.pauseDownLoad(getActivity(),fileInfo.vsid);
//        }
//        downloadViewController.getAdapter().replaceData(DownLoadManager.getDownLoadingList(getActivity()));
//        downloadViewController.getAdapter().notifyDataSetChanged();
//    }
//
//
//
//
//}
